<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>会员中心</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <!-- <style>
      img {
        display: none;
      }
    </style> -->
  </head>
  <body>
    <h1>会员中心</h1>
    <div class="userinfo"></div>
  </body>
  <script>
    //获取数据
    let sessionUname = sessionStorage.getItem("uname");
    // let localUname = 当前时间 > 存储时间 ? 过期 : 没过期
    let localUname =
      new Date().getTime() > localStorage.getItem("expires")
        ? null
        : localStorage.getItem("uname");
    let uname = sessionUname || localUname;
    //判断
    if (uname) {
      document.querySelector(".userinfo").innerHTML = `
      <h1>胖头鱼你又来了😀<br/>${uname}记得带串糖葫芦</h1>
      <img src="./冰冰老婆1.gif"/>
      <a href="./logout.html" >出门别忘回来了</a>`;
    } else {
      document.querySelector(".userinfo").innerHTML = `
       <h1><a href="./login.html" >咋忘记穿鞋了呢！</a></h1>
    `;
    }
  </script>
</html>
